using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;

namespace Skywave.Windows.Forms
{
    public enum SheetPagingDirections
    {
        HorizontalPriority,
        VerticalPriority
    }
    public enum SheetOwnerDrawModes
    {
        None = 0,
        Content = 1,
        Full = 2
    }
    public enum SheetBorderTypes
    {
        Left = 2,
        Right = 4,
        Top = 8,
        Bottom = 16,
        Outer = 32
    }
    [Flags]
    public enum SheetMergeTypes
    {
        None = 0,
        Left = 2,
        Right = 4,
        Top = 8,
        Bottom = 16
    }
    public enum SheetRangeBorderTypes
    {
        Left = 2,
        Right = 4,
        Top = 8,
        Bottom = 16,
        MiddleHorizontal = 32,
        MiddleVertical = 64,
        Inner = 128,
        Outer = 256,
        InnerOuter = 512
    }
    [Serializable()]
    internal class SheetBorder
    {
        private int mDefLBorder;
        private int mDefRBorder;
        private int mDefTBorder;
        private int mDefBBorder;

        public int this[SheetBorderTypes type]
        {
            get
            {
                switch (type)
                {
                    case SheetBorderTypes.Left:
                        return mDefLBorder;
                    case SheetBorderTypes.Right:
                        return mDefRBorder;
                    case SheetBorderTypes.Top:
                        return mDefTBorder;
                    case SheetBorderTypes.Bottom:
                        return mDefBBorder;
                    case SheetBorderTypes.Outer:
                        if ((mDefBBorder == mDefLBorder) && (mDefLBorder == mDefRBorder) && (mDefRBorder == mDefTBorder))
                            return mDefLBorder;
                        else return -1;
                    default:
                        return -1;
                }
            }
            set
            {
                switch (type)
                {
                    case SheetBorderTypes.Left:
                        mDefLBorder = value;
                        break;
                    case SheetBorderTypes.Right:
                        mDefRBorder = value;
                        break;
                    case SheetBorderTypes.Top:
                        mDefTBorder = value;
                        break;
                    case SheetBorderTypes.Bottom:
                        mDefBBorder = value;
                        break;
                    case SheetBorderTypes.Outer:
                        this[SheetBorderTypes.Left] = value;
                        this[SheetBorderTypes.Right] = value;
                        this[SheetBorderTypes.Top] = value;
                        this[SheetBorderTypes.Bottom] = value;
                        break;
                    default:
                        break;
                }
            }
        }
    }
    [Serializable()]
    public class SheetDefaults
    {
        public Font Font;
        public int RowHeight;
        public int ColumnWidth;
        public Color ForeColor;
        public Color BackColor;
        public Color BorderColor;
        public ContentAlignment TextAlign;
        public bool RightToLeft;
        public bool ShrinkToFit;
        public bool VerticalText;
        public bool Warp;

        private SheetBorder mBorder = new SheetBorder();
        public int GetBorder(SheetBorderTypes type)
        {
            return mBorder[type];
        }
        public void SetBorder(SheetBorderTypes type, int value)
        {
            mBorder[type] = value;
        }
    }
}
